﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class 消费者_新文件夹1_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void BindData()
    {
        Car_users tmp = new Car_users();
        GridView1.DataSource = tmp.getallusers().Tables[0].DefaultView;
        GridView1.DataBind();
    }
    protected void GridView1_DataBinding(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {

    }
    protected void GridView1_SelectedIndexChanging(object sender, GridViewSelectEventArgs e)
    {

    }
    protected void Button1_Click1(object sender, EventArgs e)
    {
        int a = ((GridViewRow)((Button)sender).NamingContainer).RowIndex;//获取索引
        string number = GridView1.Rows[a].Cells[0].Text;   //获取值
        string id = GridView1.Rows[a].Cells[2].Text;//获取值
        Car_users p = new Car_users();
        p.state = "已租";
        p.id = id;
        p.number = number;
        int result = p.udate(p);
        if (result < 0)
        {
            Response.Write("<script>alert(\"租车成功！！！\")</script>");
        }
        else
        {
            Response.Write("<script>alert(\"租车失败！！！\")</script>");
        }
    }
}